<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../../css/utils/bootstrap.min.css" />
    <link rel="stylesheet" href="../../css/utils/common.css" />
    <link rel="stylesheet" href="../../css/utils/toastr.min.css" />
	<title></title>
	<style>
		.publish-button {
			margin-top: 60px;
		}
		.sort-key {
			margin-top: 30px;
		}
		.row-list {
			margin-top: 20px;
		}
		.row-list .thumbnail {
			padding: 8px;
			border: none;
			background: url(../../img/myTask/block-back.png) no-repeat;
			background-size: 100% 100%;
		}
		.img-layer {
			position: relative;
			padding: 0 20px;
		}
		.row-list .caption {
			position: relative;
			padding: 0 20px;
			background: #f3f3f3;
		}
		.float-btn {
			margin-top: 50px;
			text-align: center;
		}
		.float-btn button {
			width: 168px;
		    background-color: #11B5AB;
		    color: #fff;
		    border-color: #11B5AB;
		}
		.float-btn button:focus, .float-btn button:hover {
			color: #fff;
			background-color: #2aeee2;
		}
		.btn-background {
			width: 168px;
			height: 34px;
			margin: 0 auto;
			margin-bottom: 6px;
		    background-color: #11B5AB;
		    color: #fff;
		    text-align: center;
	        border-radius: 4px;
		    line-height: 34px;
		    cursor: pointer;
		}
		.float-bottom {
			position: absolute;
			left: 20px;
			right: 20px;
			bottom: 10px;
			color: #fff;
		}
		.img-btn {
			cursor: pointer;
		}
		.img-btn img {
			width: 14px;
			margin-right: 5px;
			vertical-align: middle;
		}
		.img-btn span {
			vertical-align: middle;
		}
		.icon-bar {
			padding-top: 10px;
			height: 20px;
		}
		.icon-bar img {
			width: 14px;
			height: 14px;
			margin-right: 5px;
		}
		.text-title {
			margin-top: 15px;
			margin-bottom: 10px;
		}
		.division-line {
			margin-top: 15px;
			border-top: 1px solid #A1A1A1;
		}
		.text-title-sm {
			margin-top: 15px;
			margin-bottom: 10px;
			color: #262626;
		}
		.img-span {
			padding: 20px 0;
			height: 61px;
		}
		.img-span img {
			width: 20px;
			margin-right: 8px;
			vertical-align: middle;
		}
		.img-span span {
			vertical-align: middle;
		}
		
		.modal-body {
			padding: 15px 40px;
		}
		.table-list {
			margin-bottom: 50px;
		}
		.table-btn {
			margin: 20px 0;
		}
		
		/*预览model*/
		.preview-content {
			display: flex;
		}
		.phone-model {
			width: 220px;
			height: 450px;
			margin: 50px 100px;
			padding: 85px 13px 52px 11px;
			background: url(../../img/myExtension/phone-model.png) no-repeat;
			background-size: 100% 100%;
		}
		.phone-content {
			width: 100%;
			height: 100%;
			padding: 10px;
			color: #666666;
		}
		.phone-title {
			color: #111;
			/*font-size: 16px;*/
		}
		.phone-body {
			font-size: 12px;
		}
		.phone-body img {
			max-width: 100%;
			height: auto;
		}
		.scan-wechat {
			margin-top: 50px;
		}
		.preview-qrcode {
			width: 386px;
			height: 220px;
			border: 1px solid #A1A1A1;
			text-align: center;
		}
		.preview-qrcode .qrcode {
			width: 150px;
			height: 150px;
			margin: 0 auto;
			margin-top: 25px;
			border: 1px solid #A1A1A1;
		}
		.preview-qrcode .qrcode canvas {
			width: 100%;
			height: 100%;
		}
		.preview-qrcode .prompt {
			margin-top: 10px;
			color: #6B6B6B;
		}
		.wechat-share {
			margin-top: 100px;
			padding: 10px;
			width: 386px;
			height: 132px;
			border: 1px solid #A1A1A1;
		}
		.wechat-title {
			font-size: 16px;
			color: #666666;
		}
		.wechat-content {
			display: flex;
			margin-top: 20px;
		}
		.wechat-describe {
			width: calc(100% - 80px);
			height: 62px;
			color: #8E8E8E;
			display: -webkit-box;
		    overflow: hidden;
		    white-space: normal!important;
		    text-overflow: ellipsis;
		    word-wrap: break-word;
		    -webkit-line-clamp: 3;
		    -webkit-box-orient: vertical;
		}
		.wechat-icon img {
			vertical-align: top;
			margin-left: 10px;
			width: 60px;
			height: 60px;
		}
		/*手机页面*/
		@media (max-width: 767px) { 
			.publish-button {
				margin-top: 0;
				width: 100%;
			}	
			.floating-layer {
				opacity: 1;
			}
		}
	</style>
</head>
<body>
	<div class="content">
		<div class="btn-group btn-group-justified btn-tab publish-button" role="group" aria-label="button-group">
			<div class="btn-group" role="group">
				<button type="button" panel-data="tab-panel1" class="btn btn-default active">我分配的任务</button>
			</div>
			<div class="btn-group" role="group">
				<button type="button" panel-data="tab-panel2" class="btn btn-default">我接收的任务</button>
			</div>
		</div>
		<div class="tab-content">
			<div id="tab-panel1" class="tab-pane active">
		  		<div class="sort-key">
		  			<span class="label active" data-param="0">不限</span>
					<span class="label" data-param="1">执行中</span>
					<span class="label" data-param="2">已经结束</span>
				</div>
				<div class="row row-list">
					<!--<div class="col-sm-6 col-lg-3">
						<div class="thumbnail">
							<div class="img-layer">
								<div class="floating-layer">
									<div class="float-btn">
										<p><button class="btn btn-default" type="button">脉络图</button></p>
										<p><button class="btn btn-default" type="button">报名名单</button></p>
									</div>
									<div class="float-bottom space-between">
										<div class="img-btn">
											<img src="../../img/myExtension/delete.png" /><span>删除</span>
										</div>
										<div class="img-btn">
											<img src="../../img/myExtension/stop.png" /><span>终止</span>
										</div>
										<div class="img-btn task-details">
											<img src="../../img/myExtension/details.png" /><span>详情</span>
										</div>
										<div class="img-btn">
											<img src="../../img/myExtension/share.png" /><span>分享</span>
										</div>
									</div>
								</div>
								<div class="icon-bar">
									<img src="../../img/myExtension/content-hongbao.png" />
									<img src="../../img/myExtension/content-enroll.png" />
									<img src="../../img/myExtension/content-coupon.png" />
									<img src="../../img/myExtension/content-order.png" />
								</div>
								<div class="text-title text-ellipsis">文章标题</div>
								<div class="text-8b">发布时间：2018-4-19 16:23:05</div>
								<div class="text-8b">结束时间：2018-4-19 16:23:05</div>
								<div class="division-line"></div>
								<div class="text-title-sm">任务要求：</div>
								<div class="space-between text-8b"><div>阅读>100</div><div>转发>100</div><div>报名>100</div></div>
								<div class="division-line"></div>
								<div class="space-between text-8b img-span">
									<div><img src="../../img/myTask/task-on.png" /><span>执行中</span></div>
									<div><img src="../../img/myTask/task-status.png" /><span>执行情况：2/9</span></div>
								</div>
							</div>
							<div class="caption">
								<div class="space-between text-8b img-span">
									<div><img src="../../img/myExtension/content-read.png" /><span>1651</span></div>
									<div><img src="../../img/myExtension/content-share.png" /><span>48641</span></div>
									<div><img src="../../img/myExtension/content-praise.png" /><span>1654</span></div>
								</div>
							</div>
						</div>
					</div>-->
				</div>	
				<nav id="page1" class="text-center" aria-label="Page navigation">
					<ul class="pagination">
					</ul>
				</nav>
			</div>
			<div id="tab-panel2" class="tab-pane">
				<div class="sort-key">
					<span class="label active" data-param="0">不限</span>
					<span class="label" data-param="1">未执行</span>
					<span class="label" data-param="2">执行中</span>
					<span class="label" data-param="3">已经结束</span>
				</div>
				<div class="row row-list">
					<!--<div class="col-sm-6 col-lg-3">
						<div class="thumbnail">
							<div class="img-layer">
								<div class="floating-layer">
									<div class="float-btn">
										<p><button class="btn btn-default" type="button">脉络图</button></p>
										<p><button class="btn btn-default" type="button">报名名单</button></p>
									</div>
									<div class="float-bottom space-between">
										<div class="img-btn">
											<img src="../../img/myExtension/feedback.png" /><span>反馈</span>
										</div>
										<div class="img-btn">
											<img src="../../img/myExtension/share.png" /><span>分享</span>
										</div>
									</div>
								</div>
								<div class="icon-bar">
									<img src="../../img/myExtension/content-hongbao.png" />
									<img src="../../img/myExtension/content-enroll.png" />
									<img src="../../img/myExtension/content-coupon.png" />
									<img src="../../img/myExtension/content-order.png" />
								</div>
								<div class="text-title text-ellipsis">文章标题</div>
								<div class="text-8b">发布时间：2018-4-19 16:23:05</div>
								<div class="text-8b">结束时间：2018-4-19 16:23:05</div>
								<div class="division-line"></div>
								<div class="text-title-sm">任务要求：</div>
								<div class="space-between text-8b"><div>阅读>100</div><div>转发>100</div><div>报名>100</div></div>
								<div class="division-line"></div>
								<div class="img-span"></div>
							</div>
							<div class="caption">
								<div class="space-between text-8b img-span">
									<div><img src="../../img/myExtension/content-read.png" /><span>1651</span></div>
									<div><img src="../../img/myExtension/content-share.png" /><span>48641</span></div>
									<div><img src="../../img/myExtension/content-praise.png" /><span>1654</span></div>
								</div>
							</div>
						</div>
					</div>-->
				</div>	
				<nav id="page2" class="text-center" aria-label="Page navigation">
					<ul class="pagination">
					</ul>
				</nav>
			</div>
		</div>	
	</div>	
	
	<!-- 分配任务详情Modal -->
	<div class="modal fade bs-example-modal-lg" id="taskDetailsModel" tabindex="-1" role="dialog" aria-labelledby="taskDetailsModelLabel">
		<div class="modal-dialog modal-lg modal-1234" role="document">
			<div class="modal-content">
				<div class="modal-header">
			    	<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
			    	<h4 class="modal-title" id="taskDetailsModelLabel">分配任务详情</h4>
				</div>
			  	<div class="modal-body">
			    	<div class="table-list">
						<div class="table-btn">
							<button id="exportTable" class="btn btn-default" type="button">导出表格</button>
						</div>
						<table class="table table-bordered table-hover table-striped">
							<thead>
								<tr>
									<th>序号</th>
									<th>姓名</th>
									<th>部门</th>
									<th>职位</th>
									<th>执行情况</th>
									<th>带来的阅读数/总的阅读数</th>
									<th>带来的报名数/总的报名数</th>
									<th>转发数</th>
									<th>带来的咨询数</th>
									<th>带来的购买量</th>
									<th>代金卷下载数</th>
									<th>反馈</th>
								</tr>
							</thead>
							<tbody>
								<!--<tr>
									<td>1</td>
									<td>多浪</td>
									<td>销售部</td>
									<td>销售总监</td>
									<td>完成</td>
									<td>121/321</td>
									<td>212/522</td>
									<td>233</td>
									<td>12</td>
									<td>0</td>
									<td>31</td>
									<td>没有反馈</td>
								</tr>-->
							</tbody>
						</table>
						<nav id="taskDetailsPage" class="text-center" aria-label="Page navigation">
							<ul class="pagination">
							</ul>
						</nav>
					</div>
			  	</div>
			</div>
		</div>
	</div>
	<!--预览model-->
	<div class="modal fade bs-example-modal-lg" id="previewModel" tabindex="-1" role="dialog" aria-labelledby="previewLabel">
		<div class="modal-dialog modal-lg" role="document">
			<div class="modal-content">
				<div class="modal-header">
			    	<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
			    	<h4 class="modal-title" id="previewLabel">预览</h4>
				</div>
			  	<div class="modal-body">
			  		<div class="preview-content">
				    	<div class="phone-model">
				    		<div id="previewArticle" class="phone-content refresh-scroll">
				    			<!--<p class="phone-title">标题</p>
				    			<h6>2018-5-7 <a>张三丰</a></h6>
				    			<div class="phone-body">
                            	    
				    			</div>-->
				    		</div>
				    	</div>
				    	<div class="scan-wechat">
				    		<div class="preview-qrcode">
				    			<div class="qrcode"></div>
				    			<div class="prompt">
				    				微信扫一扫，开始分享
				    			</div>
				    		</div>
				    		<div class="wechat-share">
				    			<!--<div class="wechat-title text-ellipsis"></div>
				    			<div class="wechat-content">
				    				<div class="wechat-describe"></div>
				    				<div class="wechat-icon">
				    					<img src="../../img/HBuilder.png"/>
				    				</div>
				    			</div>-->
				    		</div>
				    	</div>
			    	</div>
			  	</div>
			</div>
		</div>
	</div>
	<!--反馈信息 -->
	<div class="modal fade" id="feedbackModal" style="margin-top: 15px;" tabindex="-1" role="dialog" aria-labelledby="feedbackModalLabel">
	  	<div class="modal-dialog" role="document">
		    <div class="modal-content">
		      	<div class="modal-header">
			        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
			        <h4 class="modal-title" id="feedbackModalLabel">反馈意见</h4>
		     	</div>
			    <div class="modal-body">
		        	<div class="form-group">
					    <input type="text" id="remarkTask" class="form-control" maxlength="20" placeholder="请输入您的意见不超过20字">
					</div>
			    </div>
		      	<div class="modal-footer">
		      		<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
		        	<button type="button" id="saveFeedback" class="btn btn-theme">确认</button>
		      	</div>
		    </div>
	  	</div>
	</div>
	<script type="text/javascript" src="../../js/utils/jquery-1.12.4.min.js"></script>
	<script type="text/javascript" src="../../js/utils/bootstrap.min.js"></script>
	<script type="text/javascript" src="../../js/utils/page.js"></script>
	<script type="text/javascript" src="../../js/utils/jquery.cookie.js" ></script>
	<script type="text/javascript" src="../../js/utils/toastr.min.js" ></script>
	<script type="text/javascript" src="../../js/utils/jquery.qrcode.min.js" ></script>
	<script type="text/javascript" src="../../js/utils/boot.js" ></script>
	<script>
		var userID,companyID,distributionType=0,receiveType=0,distributionPage=1,receivePage=1;
		$(function(){
			userID = $.cookie("userID");
			companyID = $.cookie("companyID");
			toastr.options = {
                "timeOut": 2000,
                "positionClass": "toast-middle-center"
            };
			//获取我分配的任务
			initMyDistributionTask();
			//获取我接收的任务
			initMyReceiveTask();
		});
		//初始化分配任务
		function initMyDistributionTask(){
			var param = {
				userID:userID,
				companyID:companyID,
				taskType:distributionType,
				pageNo:distributionPage
			}
			base.postData(base.url.myDistributionTask, param, callbackMyDistributionTask);
		}
		//初始化接收任务
		function initMyReceiveTask(){
			var param = {
				userID:userID,
				companyID:companyID,
				taskType:receiveType,
				pageNo:receivePage
			}
			base.postData(base.url.myReceiveTask, param, callbackMyReceiveTask);
		}
		//分配任务返回
		function callbackMyDistributionTask(data) {
			if (data.success) {
				var html = '';
				for (var i=0; i<data.context.dataList.length; i++) {
					html += pingMyDistributionTask(data.context.dataList[i]);
				}
				$("#tab-panel1 .row-list").html(html);
				if (distributionPage == 1){
					//初始化分页
					var totalPage = Math.ceil(data.context.totalPage/8);
					var page = {
						pageIndex:1,//初始页数
						currentPage:1,//当前页
						showPage:5,//显示页数
						totalPage:totalPage,//总页数
						onPageClick: function(page) {
							$("#page1").initPage(page);
							distributionPage = page.currentPage;
							initMyDistributionTask();
			    			return false;  //默认的翻页事件
					    }
					};
					$("#page1").initPage(page);
				}
			}
		}
		//接收任务返回
		function callbackMyReceiveTask(data) {
			if (data.success) {
				var html = '';
				for (var i=0; i<data.context.dataList.length; i++) {
					html += pingMyReceiveTask(data.context.dataList[i]);
				}
				$("#tab-panel2 .row-list").html(html);
				if (receivePage == 1){
					//初始化分页
					var totalPage = Math.ceil(data.context.totalPage/8);
					var page = {
						pageIndex:1,//初始页数
						currentPage:1,//当前页
						showPage:5,//显示页数
						totalPage:totalPage,//总页数
						onPageClick: function(page) {
							$("#page2").initPage(page);
							receivePage = page.currentPage;
							initMyReceiveTask();
			    			return false;  //默认的翻页事件
					    }
					};
					$("#page2").initPage(page);
				}
			}
		}
		//拼接分配任务
		function pingMyDistributionTask(data) {
			var plugNum = 0;
//			if (data.isRedPackage == 1) {
//				plugNum ++;
//			}
			if (data.isEnroll == 1) {
				plugNum ++;
			}
			if (data.isVoucher == 1) {
				plugNum ++;
			}
			if (data.isOrder == 1) {
				plugNum ++;
			}
			var html = '<div class="col-sm-6 col-lg-3">'+
						'	<div class="thumbnail">'+
						'		<input type="hidden" name="articleID" value="'+data.articleID+'" />'+
						'		<input type="hidden" name="taskID" value="'+data.taskID+'" />'+
						'		<div class="img-layer">'+
						'			<div class="floating-layer">';
						if (plugNum == 0){
				html +=	'				<div class="float-btn" style="margin-top:100px;">';
						}else if (plugNum > 1) {
				html +=	'				<div class="float-btn" style="margin-top:20px">';		
						}else{
				html +=	'				<div class="float-btn">';		
						}
				html +=	'					<div class="btn-background skeleton">脉络图</div>';
						if (data.isEnroll == 1) {
				html +=	'					<div class="btn-background enroll-list">报名名单</div>';	
						}
						if (data.isVoucher == 1) {
				html +=	'					<p><button class="btn btn-default" type="button">代金券列表</button></p>';	
						}
						if (data.isOrder == 1) {
				html +=	'					<p><button class="btn btn-default" type="button">订单列表</button></p>';
						}		
				html +=	'				</div>'+
						'				<div class="float-bottom space-between">'+
						'					<div class="img-btn task-delete">'+
						'						<img src="../../img/myExtension/delete.png" /><span>删除</span>'+
						'					</div>';
						if (data.isExecute == 1) {
				html +=	'					<div class="img-btn task-stop">'+
						'						<img src="../../img/myExtension/stop.png" /><span>中止</span>'+
						'					</div>';
						}
						if ($(window).width()>=768) {
				html +=	'					<div class="img-btn task-details">'+
						'						<img src="../../img/myExtension/details.png" /><span>详情</span>'+
						'					</div>';
						}
				html +=	'					<div class="img-btn task-share">'+
						'						<img src="../../img/myExtension/share.png" /><span>分享</span>'+
						'					</div>'+
						'				</div>'+
						'			</div>'+
						'			<div class="icon-bar">';
						if (data.isRedPackage == 1) {
				html += '				<img src="../../img/myExtension/content-hongbao.png" />';		
						}
						if (data.isEnroll == 1) {
				html += '				<img src="../../img/myExtension/content-enroll.png" />';			
						}
						if (data.isVoucher == 1) {
				html += '				<img src="../../img/myExtension/content-coupon.png" />';			
						}
						if (data.isOrder == 1) {
				html += '				<img src="../../img/myExtension/content-order.png" />';			
						}
				html += '			</div>';
						if(!!window.navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)){
				html += '			<div style="width:295px" class="text-title text-ellipsis">'+data.articleTitle+'</div>';
						}else{
				html += '			<div class="text-title text-ellipsis">'+data.articleTitle+'</div>';
						}
				html += '			<div class="text-8b">任务开始时间：'+(data.isLimitDate == 0?"不限":data.taskStartTime)+'</div>'+
						'			<div class="text-8b">任务结束时间：'+(data.isLimitDate == 0?"不限":data.taskEndTime)+'</div>'+
						'			<div class="division-line"></div>'+
						'			<div class="text-title-sm">任务要求：</div>'+
						'			<div class="space-between text-8b"><div>阅读>'+data.taskReadNum+'</div><div>转发>'+data.taskTransmitNum+'</div><div>报名>'+data.taskEnrollNum+'</div></div>'+
						'			<div class="division-line"></div>'+
						'			<div class="space-between text-8b img-span">';
						if (data.isExecute == 0) {
				html += '				<div><img src="../../img/myTask/task-end.png" /><span>已结束</span></div>';	
						}else{
				html += '				<div><img src="../../img/myTask/task-on.png" /><span>执行中</span></div>';			
						}
				html += '				<div><img src="../../img/myTask/task-status.png" /><span>执行情况：'+data.executeData+'</span></div>'+
						'			</div>'+
						'		</div>'+
						'		<div class="caption">'+
						'			<div class="space-between text-8b img-span">'+
						'				<div><img src="../../img/myExtension/content-read.png" /><span>'+data.articleReadNum+'</span></div>'+
						'				<div><img src="../../img/myExtension/content-share.png" /><span>'+data.articleTransmitNum+'</span></div>'+
						'				<div><img src="../../img/myExtension/content-praise.png" /><span>'+data.articleLikeNum+'</span></div>'+
						'			</div>'+
						'		</div>'+
						'	</div>'+
						'</div>';
			return html;
		}
		//拼接接收任务
		function pingMyReceiveTask(data) {
			var plugNum = 0;
//			if (data.isRedPackage == 1) {
//				plugNum ++;
//			}
			if (data.isEnroll == 1) {
				plugNum ++;
			}
			if (data.isVoucher == 1) {
				plugNum ++;
			}
			if (data.isOrder == 1) {
				plugNum ++;
			}
			var html = '<div class="col-sm-6 col-lg-3">'+
						'	<div class="thumbnail">'+
						'		<input type="hidden" name="articleID" value="'+data.articleID+'" />'+
						'		<input type="hidden" name="taskID" value="'+data.taskID+'" />'+
						'		<div class="img-layer">'+
						'			<div class="floating-layer">';
						if (plugNum == 0){
				html +=	'				<div class="float-btn" style="margin-top:100px;">';
						}else if (plugNum > 1) {
				html +=	'				<div class="float-btn" style="margin-top:20px">';		
						}else{
				html +=	'				<div class="float-btn">';		
						}
				html +=	'					<div class="btn-background skeleton">脉络图</div>';
						if (data.isEnroll == 1) {
				html +=	'					<div class="btn-background enroll-list">报名名单</div>';	
						}
						if (data.isVoucher == 1) {
				html +=	'					<p><button class="btn btn-default" type="button">代金券列表</button></p>';	
						}
						if (data.isOrder == 1) {
				html +=	'					<p><button class="btn btn-default" type="button">订单列表</button></p>';
						}
				html +=	'				</div>'+
						'				<div class="float-bottom space-between">'+
						'					<div class="img-btn task-feedback">'+
						'						<img src="../../img/myExtension/feedback.png" /><span>反馈</span>'+
						'					</div>'+
						'					<div class="img-btn task-share">'+
						'						<img src="../../img/myExtension/share.png" /><span>分享</span>'+
						'					</div>'+
						'				</div>'+
						'			</div>'+
						'			<div class="icon-bar">';
						if (data.isRedPackage == 1) {
				html += '				<img src="../../img/myExtension/content-hongbao.png" />';		
						}
						if (data.isEnroll == 1) {
				html += '				<img src="../../img/myExtension/content-enroll.png" />';			
						}
						if (data.isVoucher == 1) {
				html += '				<img src="../../img/myExtension/content-coupon.png" />';			
						}
						if (data.isOrder == 1) {
				html += '				<img src="../../img/myExtension/content-order.png" />';			
						}
				html += '			</div>';
						if(!!window.navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)){
				html += '			<div style="width:295px" class="text-title text-ellipsis">'+data.articleTitle+'</div>';
						}else{
				html += '			<div class="text-title text-ellipsis">'+data.articleTitle+'</div>';
						}
				html += '			<div class="text-8b">任务开始时间：'+(data.isLimitDate == 0?"不限":data.taskStartTime)+'</div>'+
						'			<div class="text-8b">任务结束时间：'+(data.isLimitDate == 0?"不限":data.taskEndTime)+'</div>'+
						'			<div class="division-line"></div>'+
						'			<div class="text-title-sm">任务要求：</div>'+
						'			<div class="space-between text-8b"><div>阅读>'+data.taskReadNum+'</div><div>转发>'+data.taskTransmitNum+'</div><div>报名>'+data.taskEnrollNum+'</div></div>'+
						'			<div class="division-line"></div>'+
						'			<div class="img-span"></div>'+
						'		</div>'+
						'		<div class="caption">'+
						'			<div class="space-between text-8b img-span">'+
						'				<div><img src="../../img/myExtension/content-read.png" /><span>'+data.articleReadNum+'</span></div>'+
						'				<div><img src="../../img/myExtension/content-share.png" /><span>'+data.articleTransmitNum+'</span></div>'+
						'				<div><img src="../../img/myExtension/content-praise.png" /><span>'+data.articleLikeNum+'</span></div>'+
						'			</div>'+
						'		</div>'+
						'	</div>'+
						'</div>';
			return html;
		}
		//分配任务状态查询
		$("#tab-panel1 .sort-key").on("click", "span", function(){
			if ($(this).attr("class").indexOf("active") != -1) {
				return;
			}
			$(this).closest(".sort-key").find("span").removeClass("active");
			$(this).addClass("active");
			distributionType = $(this).attr("data-param"); 
			distributionPage = 1;
			initMyDistributionTask();
		});
		//接收任务状态查询
		$("#tab-panel2 .sort-key").on("click", "span", function(){
			if ($(this).attr("class").indexOf("active") != -1) {
				return;
			}
			$(this).closest(".sort-key").find("span").removeClass("active");
			$(this).addClass("active");
			receiveType = $(this).attr("data-param"); 
			receivePage = 1;
			initMyReceiveTask();
		});
		//切换分配任务和接收任务
		$(".publish-button").on("click", "button", function(){
			$(".publish-button button").removeClass("active");
			$(this).addClass("active");
			var panelId = $(this).attr("panel-data");
			$(".tab-content .tab-pane").removeClass("active");
			$("#"+panelId).addClass("active");
		});
		//鼠标悬浮
		$(".row-list").on("mouseover mouseout", ".thumbnail", function(event){
			if($(window).width()<768){
				return;
			}
			if(event.type == "mouseover"){
				//鼠标悬浮
				$(this).find(".floating-layer").css("opacity", "1");
			}else if(event.type == "mouseout"){
				//鼠标离开
				$(this).find(".floating-layer").css("opacity", "0");
			}
		});
		//点击任务删除
		$("#tab-panel1 .row-list").on("click", ".task-delete", function(){
			var msg = confirm("确定要删除推文吗！");
			if (msg == true){
				var taskID = $(this).closest(".thumbnail").find("input[name='taskID']").val();
				base.postData(base.url.deleteTask, {userID:userID,taskID:taskID}, callbackDeleteTask);
			}
			
		});
		function callbackDeleteTask(data){
			if (data.success) {
				toastr.success("删除任务成功");
				distributionPage = 1;
				initMyDistributionTask();
			}else{
				toastr.warning(data.msg);
			}
		}
		//点击任务终止
		$("#tab-panel1 .row-list").on("click", ".task-stop", function(){
			var taskID = $(this).closest(".thumbnail").find("input[name='taskID']").val();
			base.postData(base.url.taskStop, {userID:userID,taskID:taskID}, callbackTaskStop);
		});
		function callbackTaskStop(data){
			if (data.success) {
				toastr.success("中止成功");
				distributionType = 0;
				distributionPage = 1;
				initMyDistributionTask();
			}else{
				toastr.warning(data.msg);
			}
		}
		//点击任务详情
		var detailsTaskID,detailsArticleID,isPageInit = true;
		$("#tab-panel1 .row-list").on("click", ".task-details", function(){
			detailsTaskID = $(this).closest(".thumbnail").find("input[name='taskID']").val();
			detailsArticleID = $(this).closest(".thumbnail").find("input[name='articleID']").val();
			initTaskDetailsInfo(1);
		});
		function initTaskDetailsInfo(pageNo){
			var data = {
				userID:userID,
				companyID:companyID,
				taskID:detailsTaskID,
				articleID:detailsArticleID,
				pageNo:pageNo
			}
			base.postData(base.url.taskInfo, data, callbackTaskInfo);
		}
		function callbackTaskInfo(data) {
			if (data.success) {
				$('#taskDetailsModel').modal('show');
				var html = '';
				for (var i=0; i<data.context.taskInfoList.length; i++) {
					html += pingTaskInfoList(data.context.taskInfoList[i],i+1);
				}
				$('#taskDetailsModel tbody').html(html);
				if (isPageInit){
					isPageInit = false;
					//初始化分页
					var totalPage = Math.ceil(data.context.totalPage/10);
					if (totalPage == 0) {
						totalPage = 1;
					}
					var page = {
						pageIndex:1,//初始页数
						currentPage:1,//当前页
						showPage:5,//显示页数
						totalPage:totalPage,//总页数
						onPageClick: function(page) {
							$("#taskDetailsPage").initPage(page);
							initTaskDetailsInfo(page.currentPage)
			    			return false;  //默认的翻页事件
					    }
					};
					$("#taskDetailsPage").initPage(page);
				}
			}else{
				toastr.warning(data.msg);
			}
		}
		function pingTaskInfoList(data, i) {
			var html = '<tr>'+
						'	<td>'+i+'</td>'+
						'	<td>'+data.username+'</td>'+
						'	<td>'+data.depart+'</td>'+
						'	<td>'+data.post+'</td>'+
						'	<td>'+(data.isExecute == 0?"未执行":"已执行")+'</td>'+
						'	<td>'+data.articleReadNum+'/'+data.totalReadNum+'</td>'+
						'	<td>'+data.articleEnrollNum+'/'+data.totalEnrollNum+'</td>'+
						'	<td>'+data.articleTransmitNum+'</td>'+
						'	<td>'+data.articleConsultNum+'</td>'+
						'	<td>'+data.articleOrderNum+'</td>'+
						'	<td>'+data.articleVoucherNum+'</td>'+
						'	<td>'+data.remark+'</td>'+
						'</tr>';
			return html;
		}
		//点击导出表格
		$("#exportTable").click(function(){
			if ($("#taskDetailsModel tbody").find("tr").length == 0) {
				return;
			}
			window.location.href=base.url.exportTaskInfo+"?userID="+userID+"&companyID="+companyID+"&articleID="+detailsArticleID+"&taskID="+detailsTaskID;
		});
		//点击分享
		$(".row-list").on("click", ".task-share", function(){
			var taskID = $(this).closest(".thumbnail").find("input[name='taskID']").val();
			var articleID = $(this).closest(".thumbnail").find("input[name='articleID']").val();
			base.postData(base.url.shareTask, {userID:userID,companyID:companyID,taskID:taskID,articleID:articleID}, callbackShareTask);
		});
		function callbackShareTask(data){
			if (data.success) {
				if($(window).width()<768){
					window.parent.location = data.context.QRCodeUrl;
					return;
				}
				var preview = '<p class="phone-title">'+data.context.articleTitle+'</p>'+
			    			  '<h6>'+base.getNowFormatToday()+'&nbsp;<a>'+$.cookie("userName")+'</a></h6>'+
			    			  '<div class="phone-body">'+data.context.articleContent+'</div>';
				$("#previewArticle").html(preview);
				$('.preview-qrcode .qrcode').html("");
				$('.preview-qrcode .qrcode').qrcode(data.context.QRCodeUrl);
				var wechat = '<div class="wechat-title text-ellipsis">'+data.context.articleTitle+'</div>'+
		    				'<div class="wechat-content">'+
			    			'	<div class="wechat-describe">'+data.context.articleAbstracts+'</div>'+
			    			'	<div class="wechat-icon">'+
			    			'		<img src="'+data.context.articleImage+'"/>'+
			    			'	</div>'+
			    			'</div>';
				$(".wechat-share").html(wechat);
				$("#previewModel").modal('show');
			}else{
				toastr.warning(data.msg);
			}
		}
		//点击反馈
		$("#tab-panel2 .row-list").on("click", ".task-feedback", function(){
			detailsTaskID = $(this).closest(".thumbnail").find("input[name='taskID']").val();
			$("#feedbackModal").modal('show');
		});
		//保存反馈
		$("#saveFeedback").click(function(){
			var remark = $("#remarkTask").val();
			base.postData(base.url.feedbackTask, {userID:userID,companyID:companyID,taskID:detailsTaskID,remark:remark}, callbackFeedbackTask);
		});
		function callbackFeedbackTask(data){
			if (data.success) {
				toastr.success("反馈成功");
				$("#feedbackModal").modal('hide');
			}else{
				toastr.warning(data.msg);
			}
		}
		//跳转脉络图
		$(".row-list").on("click", ".skeleton", function(){
			var articleID = $(this).closest(".thumbnail").find("input[name='articleID']").val();
			if($(window).width()<768){
				window.parent.location = "../index.html?path=myExtension/connectionChartPhone.html?articleID="+articleID+"&relationType="+1;
			}else{
				window.parent.location = "../index.html?path=myExtension/connectionChart.html?articleID="+articleID+"&relationType="+1;
			}
		});	
		//跳转报名列表
		$(".row-list").on("click", ".enroll-list", function(){
			var articleID = $(this).closest(".thumbnail").find("input[name='articleID']").val();
			window.parent.location = "../index.html?path=myExtension/enrollList.html?articleID="+articleID;
		});
	</script>
</body>
</html>
